<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: huangrulan
  Date: 2019/4/15
  Time: 11:25 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <title>阿星影院在线售票</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="Author" content="larry"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="${base}/static/css/index/40d4116c.css">
    <link rel="stylesheet" href="${base}/static/css/index/ef9cella.css">
    <link rel="stylesheet" href="${base}/static/css/index/c339c8d8.css">
    <link rel="stylesheet" href="${base}/static/css/index/8ba7074d.css">
    <link rel="stylesheet" href="${base}/assets/css/layui/layui.css">
    <link rel="stylesheet" href="${base}/assets/css/global.css">
    <link rel="stylesheet" href="${base}/assets/css/larryms.css">
    <link rel="stylesheet" href="${base}/assets/css/admin.css">
    <style>
        .layui-fluid {
            width: 100%;
            height: 100%;
            padding: 0px;
            margin: 0px;
            overflow-y: scroll;
        }
        .larryms-page-header a {
            display: inline-block;
            height: 30px;
            line-height: 28px;
            padding: 0 5px;
            background-color: #009688;
            color: #fff;
            white-space: nowrap;
            text-align: center;
            font-size: 14px;
            border: none;
            border-radius: 2px;
            cursor: pointer;
            float: right;
        }
        .layui-layer.layui-layer-iframe{
            top: 150px;
        }
    </style>
</head>
<body class="larry-bg-gray">
<div class="header">
    <div class="header-inner">
        <img src="${base}/static/image/star.png">
        <div class="ciname-name">阿星影城</div>
        <div class="user-info">
            <div class="user-avatar has-login">
                <img src="${user.header}">
                <span class="caret"></span>
                <ul class="user-menu">
                    <li class="text">
                        <a href="${base}/ticket/user/orderInfo.page">我的订单</a>
                        <input type="hidden" name="userId" value="${user.id}">
                    </li>
                    <li class="text login-name"><a href="${base}/ticket/index/index.page">返回首页</a></li>
                    <li class="text login-name"><a href="${base}/ticket/user/userInfo.page?userId=${user.id}">个人中心</a></li>
                    <li class="text"><a href="${base}/login/logout.do" class="J-logout">退出登录</a></li>
                </ul>
            </div>
        </div>
    </div>
</div>
<div class="header-placeholder"></div>
<div class="layui-fluid">
    <div class="larry-container larryms-admin">
        <div class="layui-row layui-col-space20">
            <div class="layui-col-xs12 layui-col-sm5 layui-col-md3 layui-col-lg3 animated fadeInUp">
                <section class="larry-panel">
                    <div class="admin-info">
                        <div class="photo">
                            <img id="avatar" src="${user.header}"></div>
                        <h3 class="larryms-user">账户余额(元)：<span id="money" style="color: red;">${user.balance}</span></h3>
                        <div style="text-align: center; margin-top: 20px;">
                            <button type="button" id="recharge" class="layui-btn layui-btn-normal">去充值</button>
                        </div>
                    </div>
                </section>
            </div>
            <div class="layui-col-xs12 layui-col-sm6 layui-col-md7 layui-col-lg7 animated fadeInRightBig">
                <section class="larry-panel">
                    <div class="larryms-page-header">
                        <span class="tit">阿星影城VIP客户，你好</span>
                    </div>
                    <div class="larry-menu-add" style="margin-top: 20px;">
                        <form class="layui-form" id="userForm" action="${base}/ticket/user/save.do" enctype="multipart/form-data" method="post">

                            <input type="hidden" name="id" value="${user.id}">

                            <div class="layui-form-item">
                                <label class="layui-form-label">用户名：</label>
                                <div class="layui-input-block">
                                    <input class="layui-input" type="text" name="userName"
                                           lay-verify="required|username" autocomplete="off" value="${user.userName}"/>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">电话：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="mobile" autocomplete="off" class="layui-input" value="${user.mobile}">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">邮箱：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="email" autocomplete="off" class="layui-input" value="${user.email}">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">年龄：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="age" autocomplete="off" class="layui-input" value="${user.age}">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">性别：</label>
                                <div class="layui-input-block">
                                    <input type="radio" name="sex" value="1" title="男" <c:if test="${user.sex == 1}">checked</c:if>>
                                    <input type="radio" name="sex" value="2" title="女" <c:if test="${user.sex == 2}">checked</c:if>>
                                </div>
                            </div>
                            <div class="center" style="text-align: center; margin-top: 20px;">
                                <button type="button" class="layui-btn" lay-submit lay-filter="submitUser" style="width: 200px;">提交</button>
                            </div>
                        </form>
                    </div>
                </section>
            </div>
        </div>
    </div>
</div>
<script src="${base}/assets/js/layui/layui.js"></script>
<script>
    layui.use(['form', 'element', 'layer', 'jquery'], function(){
        var form = layui.form, element = layui.element, layer = layui.layer, $ = layui.jquery;

        //监听提交
        form.on('submit(submitUser)', function(data){
            console.log(11111);
            // layer.msg(JSON.stringify(data.field));
            $.ajax({
                url: 'save.do',
                data: data.field,
                type: 'POST',
                dataType: 'json',
                async: false,
                success: function (res) {
                    console.log(1111111);
                    if (res.success) {
                        layer.msg(res.data, {icon: 1, time: 2000}, function () {

                        });
                    }
                }
            });
        });

        $(document).on("click", "#recharge", function () {
            layer.open({
                type: 2,
                area: ['520px', '500px'],
                scrollbar: false,
                offset: '150px',
                content: 'recharge.page'
            });
        });
    });
</script>
<body>
